package com.srd.phone.bean;

import com.srd.phone.utils.CommonUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class ChargeRecord {

    public int id;
    public String ctime;
    public String money;
    public int uid;
    public String cstatem;
    public String banknm;

    public static List<ChargeRecord> parseData(String json){

        List<ChargeRecord> list = new ArrayList<ChargeRecord>();

        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                ChargeRecord item = new ChargeRecord();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.money = jsonObject.getString("money");
                item.ctime = CommonUtils.formatDataStr(jsonObject.getString("ctime"));
                item.cstatem = jsonObject.optString("cstatem");
                item.banknm = jsonObject.optString("banknm");
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
